package org.zfes.snowier.cloud.zbss.cms.router.service.topic;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.topic.model.CmsTopicTxt;
import org.zfes.snowier.cloud.zbss.cms.topic.service.ICmsTopicTxtService;
@Controller 
@RequestMapping("/cms/topic/cmsTopicTxt")
public class CmsTopicTxtController extends BaseController {

	
	@Autowired
	private ICmsTopicTxtService cmsTopicTxtService;
	
	@RequiresPermissions(value="cmsTopicTxt:loadCmsTopicTxtDataSet",desc="专题文本列表")
    @RequestMapping(value="/loadCmsTopicTxtDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicTxtDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsTopicTxtService.loadCmsTopicTxtDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsTopicTxt:createCmsTopicTxt",desc="专题文本添加")
    @RequestMapping(value="/createCmsTopicTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsTopicTxt(CmsTopicTxt cmsTopicTxt){
		cmsTopicTxtService.createCmsTopicTxt(cmsTopicTxt);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicTxt:loadCmsTopicTxt",desc="专题文本加载")
    @RequestMapping(value="/loadCmsTopicTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicTxt(Long id){
		Optional<CmsTopicTxt> ops = cmsTopicTxtService.loadCmsTopicTxtById(id);
		return ajaxQuery("cmsTopicTxt",ops);
    }
	
	@RequiresPermissions(value="cmsTopicTxt:updateCmsTopicTxt",desc="专题文本更新")
    @RequestMapping(value="/updateCmsTopicTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsTopicTxt(CmsTopicTxt cmsTopicTxt){
		cmsTopicTxtService.updateCmsTopicTxt(cmsTopicTxt);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicTxt:deletCmsTopicTxt",desc="专题文本删除")
    @RequestMapping(value="/deleteCmsTopicTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsTopicTxt(Long id){
		cmsTopicTxtService.deleteCmsTopicTxt(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}